import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import { Layout, Home, Login, CarFriend, SelectCar, SmallVedio, CarDetail, ListDetail, My } from '@/views'
export const layoutChildren: Array<RouteRecordRaw> = [{
  path: '/',
  name: 'home',
  component: Home,
  meta: {
    title: '首页'
  }
}, {
  path: '/select/car',
  name: 'selectCar',
  component: SelectCar,
  meta: {
    title: '选车'
  }
}, {
  path: '/car/friend',
  name: 'carFriend',
  component: CarFriend,
  meta: {
    title: '车友圈'
  }
}, {
  path: '/small/vedio',
  name: 'smallVedio',
  component: SmallVedio,
  meta: {
    title: '小视频'
  }
}]

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: layoutChildren
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/select/car/:brand_id',
    name: 'carDetail',
    component: CarDetail
  }, {
    path: '/list/:id',
    name: 'listDetail',
    component: ListDetail
  },
  {
    path: '/my',
    name: 'my',
    component: My
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
